/**
 * @file mjnexceptions.h
 * @brief Collection of exceptions to be used in MahJong Night classes
 *
 * All project exception classes should be stored here except BaseException.
 * All exception classes should be derived from BaseException.
 *
 * @sa BaseException
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3 of the License.
 *
 * @author VestniK (Sergey N.Vidyuk) sir.vestnik@gmail.com
 * @date 25 Oct 2008
 */
#ifndef _MJNExceprions_H_
#define _MJNExceprions_H_

#include <QtCore>

#include "baseexception.h"

namespace mjn {

   /** @brief Attempt to take tile from empty wall exception
    *
    * This exception is thrown in case of attempt to take tile from really
    * empty wall. In normal situation wall always contain tiles since according
    * to traditional chineese mahjong rules round failed if wall contains only
    * 14 tiles. That's why such situation signalled by exception. The only
    * reason why this exception can be thrown is bug in game logic.
    */
   class WallEmptyException: public BaseException {
      public:
         WallEmptyException() {
            addStdPrefix("mjn::WallEmptyException");
            reason += "Attempt to take tile from empty wall";
         };
   };

   /** @brief Attempt to fill tileset with incorrect tiles
    *
    * This exception is thrown if incorrect tile was created during tilest
    * filling.
    */
   class IncorrectTileset: public BaseException {
      public:
         IncorrectTileset() {
            addStdPrefix("mjn::IncorrectTileset");
            reason += "Attempt to fill tileset with incorrect tiles.";
         };
   };

   /** @brief Attempt to take tile from empty dead end exception
    *
    * This exception should never be thrown since Wall::takeFromDeadEnd() method
    * checks if dead end is empty after tile is taken and refills dead end if
    * it's necessary.
    */
   class DeadEndEmptyException: public BaseException {
      public:
         DeadEndEmptyException() {
            addStdPrefix("mjn::DeadEndEmptyException");
            reason += "Attempt to take tile from empty dead end";
         }
   };

} // namespace mjn

#endif // #ifndef _MJNExceprions_H_
